/*
 * @Author: zxh
 * @Email: 1271027008@qq.com
 * @Date: 2020-02-24 08:53:29
 * @Descripttion: 
 */
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable } from "rxjs";
import { SubwarehouseManageService } from '../../basedata-manage/subwarehouse-manage/subwarehouse-manage.service';
import { DictionaryManageService } from '../../../system-manage/dictionary-manage/dictionary-manage.service';

@Injectable({
  providedIn: 'root'
})
export class SafemanageListService {

  constructor(
    private http:HttpClient,
    private SubwarehouseManageService:SubwarehouseManageService,
    private DictionaryManageService:DictionaryManageService
  ) { }

  private materialUrl = '/api/stocksafemanager'
  private editKCUrl = '/api/stocksafemanager/updateSafeManager'

  // 获取库房列表
  getKFList(): Observable<any>{
    return this.SubwarehouseManageService.getKFAllList()
  }
  // 获取库区列表
  getKQList(data): Observable<any>{
    let _dataJson = {
      ...data
    }
    return this.SubwarehouseManageService.getKQAllList(_dataJson)
  }
  // 获取存料类型
  getCLList(data): Observable<any>{
    let _dataJson = {
      ...data
    }
    return this.DictionaryManageService.getDetailAll(_dataJson)
  }

  // 获取物料详情
  getMaterialList(data): Observable<any>{
    let _dataJson = {
      ...data
    }
    return this.http.get(this.materialUrl,{params:_dataJson}).pipe()
  }

  // 修改安全库存
  editKC(data): Observable<any>{
    let _dataJson = {
      ...data
    }
    return this.http.post(this.editKCUrl,_dataJson).pipe()
  }

}
